#ifndef __syntax_char_H__
#define __syntax_char_H__

#include "syntax_base.h"
#include "syntax_attribute.h"

namespace syntax_analysis
{

	class syntax_char : public syntax
	{
	// construct
	public:
		syntax_char() : syntax()
		{
			m_char = 0;
			m_attr = NULL;
		}

		syntax_char( int ichar, syntax_attribute *attr )
		{
			m_char = ichar;
			m_attr = attr;
		}

		virtual ~syntax_char()
		{
			if( m_attr != NULL )
				delete m_attr;
			m_char = 0;
			m_attr = NULL;
		}

	// inherit
	public:
		virtual syntax_type get_type();
		virtual string to_string();
		
		virtual bool parse( parse_info *info );
		virtual bool reparse( parse_info *info );
		virtual bool can_accept_more( parse_para *para );
		virtual bool should_accept_more( parse_para *para );

	// common
	public:
		int get_char()
		{
			return m_char;
		}

		void set_char( int ichar )
		{
			m_char = ichar;
		}

		syntax_attribute* get_attr()
		{
			return m_attr;
		}

		void set_attr( syntax_attribute* attr )
		{
			if( m_attr != NULL )
				delete m_attr;
			m_attr = attr;
		}

	protected:
		virtual bool do_parse( parse_para *para );

	private:
		int m_char;
		syntax_attribute *m_attr;
	};

}

#endif // __syntax_char_h__
